import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/IndexView.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/HomeView.vue')
      },
      {
        path: '/salemenu',
        name: 'salemenu',
        component: () => import('../views/element/SaleMenu.vue')
      },
      {
        path: '/salerecords',
        name: 'salerecords',
        component: () => import('../views/element/SaleRecords.vue')
      },
      {
        path: '/pointsrecords',
        name: 'pointsrecords',
        component: () => import('../views/element/PointsExchangeRecords.vue')
      },
      {
        path: '/employee',
        name: 'employee',
        component: () => import('../views/element/EmployeeView.vue')
      },
      {
        path: '/VIP',
        name: 'VIP',
        component: () => import('../views/element/VIPView.vue')
      },
      {
        path: '/pwd',
        name: 'pwd',
        component: () => import('../views/element/PwdChange.vue')
      },
      {
        path: '/goods',
        name: 'goods',
        component: () => import('../views/element/GoodsView.vue')
      },
      {
        path: '/inInventory',
        name: 'inInventory',
        component: () => import('../views/element/InInventoryView.vue')
      },
      {
        path: '/outInventory',
        name: 'outInventory',
        component: () => import('../views/element/OutInventoryView.vue')
      },
      {
        path: '/supplier',
        name: 'supplier',
        component: () => import('../views/element/SupplierView.vue')
      },
      {
        path: '/inventorystatistics',
        name: 'inventorystatistics',
        component: () => import('../views/element/InventoryStatisticsView.vue')
      },
      {
        path: '/VIPgoods',
        name: 'VIPgoods',
        component: () => import('../views/element/VIPGoods.vue')
      },
      {
        path: '/salestatistics',
        name: 'salestatistics',
        component: () => import('../views/element/SaleStatisticsView.vue')
      },
      {
        path: '/userinf',
        name: 'userinf',
        component: () => import('../views/element/UserInf.vue')
      },
      {
        path: '/parchase',
        name: 'parchase',
        component: () => import('../views/element/ParchaseView.vue')
      }
    ]
  },
  {
    path: '/',
    redirect: 'login'   //重定向
  }
]

const router = new VueRouter({
  routes
})

export default router
